import axios from 'axios';
import Qs from 'qs';

// 登录，仅获取token
// export function login(data) {
// 	const q = { ...data, scope: 'all' };
// 	const param = Qs.stringify(q);
// 	return axios.post('/sys-auth/oauth/token', param);
// }

export function BIMBaseLogin(origin, id, secret) {
	const param = Qs.stringify({
		grant_type: 'client_credentials',
		client_id: id,
		client_secret: secret
	});
	return axios.post(`${origin}/graphics-engine/bimserver/auth/oauth/token`, param, {
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded',
			isNeedToken: 'false'
		}
		// baseURL: '/bim_base_api'
	});
}
